<template>
  <ContentWrap>
    <AmisRender :schema="schema" />
  </ContentWrap>
</template>

<script setup>
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'
import AmisRender from '@/components/amis/AmisRender.vue'
import { getId } from '@/api/infra/amis'

const { currentRoute } = useRouter()
const schema = ref({})
onMounted(() => {
  console.log('router', currentRoute.meta)
  // 尝试获取并渲染amis配置
  getId(currentRoute.value.meta?.query?.amisid || 126).then((response) => {
    const json = JSON.parse(response.json)
    schema.value = json
  })
})
</script>

<style scoped>
.divPadding {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 8px;
}
</style>
